home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha Extra 2004 January / CyberMycha Extra 1-2004 (Poland) (Disc 2).bin / Pippi / gmsl.dir / Internal_51_slScript.ls < prev    next >
Encoding:
Text File  |  2001-09-04  |  6.9 KB  |  301 lines

  1. property numName, foundList, hiddenList, collectList, hinderList, overLayList, saveObjectList, pippi, pippiMate, fence, garden, foundSprite, stopSprite, moveAm, stopRotation, interSectValue, buttonPlayMode, finished, xFrame, stopCounter, thingNumberList, actualGroup
  2. global autoMoveObject, sndObject, sessionObject
  3.  
  4. on new me
  5.   xFrame = integer(the frameLabel)
  6.   v = xFrame + 1
  7.   if v = 5 then
  8.     v = 1
  9.   end if
  10.   sessionObject.upCountGmMovie(v)
  11.   stopCounter = the ticks + (15 * 60)
  12.   numName = the frameLabel
  13.   moveAm = [0, 0]
  14.   buttonPlayMode = 1
  15.   hinderList = []
  16.   overLayList = []
  17.   saveObjectList = []
  18.   stopSprite = 0
  19.   stopRotation = 0
  20.   makeFoundList(me)
  21.   finished = 0
  22.   thingNumberList = [[5, 1, 2, 2], [6, 1, 1, 2], [6, 3, 3, 2, 3], [8, 2, 1]]
  23.   actualGroup = 1
  24.   return me
  25. end
  26.  
  27. on buildBoat me, meGroup
  28.   thingNumberList[xFrame][meGroup] = thingNumberList[xFrame][meGroup] - 1
  29.   if thingNumberList[xFrame][meGroup] = 0 then
  30.     actualGroup = meGroup + 1
  31.     if actualGroup > thingNumberList[xFrame].count then
  32.       repeat while soundBusy(2) = 1
  33.       end repeat
  34.       t = the ticks + 150
  35.       repeat while the ticks < t
  36.       end repeat
  37.       sound(2).play(member("sail" & string(xFrame), 1))
  38.       go(the frame + 1)
  39.     end if
  40.   end if
  41. end
  42.  
  43. on makeFoundList me
  44.   foundList = []
  45.   hiddenList = []
  46.   collectList = []
  47.   repeat with n = 1 to 1000
  48.     if member(n, 1).name.char[1..5] = ("sloa" & numName) then
  49.       startNum = n
  50.       exit repeat
  51.     end if
  52.   end repeat
  53.   repeat with n = startNum to 1000
  54.     if member(n, 1).name.char[1..6] = ("sloa" & numName & "o") then
  55.       foundList[foundList.count + 1] = member(n, 1)
  56.       hiddenList[hiddenList.count + 1] = member(n, 1)
  57.       next repeat
  58.     end if
  59.     exit repeat
  60.   end repeat
  61. end
  62.  
  63. on traceCursor me, pPos
  64.   H = pPos[1] - pippi.loc[1]
  65.   v = pPos[2] - pippi.loc[2]
  66.   Offv = v / 2
  67.   if Offv < 0 then
  68.     Offv = Offv * -1
  69.   end if
  70.   vOff = Offv
  71.   Offh = H / 2
  72.   if Offh < 0 then
  73.     Offh = Offh * -1
  74.   end if
  75.   hOff = Offh
  76.   if (H <= vOff) and (H >= (vOff * -1)) then
  77.     leftRight = 0
  78.   else
  79.     if H > vOff then
  80.       leftRight = 1
  81.     else
  82.       leftRight = -1
  83.     end if
  84.   end if
  85.   if (v <= hOff) and (v >= (hOff * -1)) then
  86.     upDown = 0
  87.   else
  88.     if v > hOff then
  89.       upDown = 1
  90.     else
  91.       upDown = -1
  92.     end if
  93.   end if
  94.   if leftRight = 0 then
  95.     if upDown = -1 then
  96.       X = 1
  97.       moveAm = [0, 3]
  98.     else
  99.       if upDown = 1 then
  100.         X = 5
  101.         moveAm = [0, -3]
  102.       end if
  103.     end if
  104.   end if
  105.   if leftRight = -1 then
  106.     if upDown = -1 then
  107.       X = 8
  108.       moveAm = [2, 2]
  109.     else
  110.       if upDown = 1 then
  111.         X = 6
  112.         moveAm = [2, -2]
  113.       else
  114.         X = 7
  115.         moveAm = [3, 0]
  116.       end if
  117.     end if
  118.   end if
  119.   if leftRight = 1 then
  120.     if upDown = -1 then
  121.       X = 2
  122.       moveAm = [-2, 2]
  123.     else
  124.       if upDown = 1 then
  125.         X = 4
  126.         moveAm = [-2, -2]
  127.       else
  128.         X = 3
  129.         moveAm = [-3, 0]
  130.       end if
  131.     end if
  132.   end if
  133.   moveAm = moveAm * 2
  134.   if voidp(X) = 0 then
  135.     rot = (X * 45) - 45
  136.     if pippi.rotation <> rot then
  137.       pippi.rotation = rot
  138.       updateStage()
  139.       if (pippi.playing = 0) and (buttonPlayMode = 1) then
  140.         A = stopRotation - rot
  141.         b = integer(A)
  142.         if b < 0 then
  143.           c = b * -1
  144.         else
  145.           c = b
  146.         end if
  147.         if me.tryFirst() = 1 then
  148.           stopSprite = 0
  149.           moveEveryHopa(me)
  150.           pippi.play()
  151.           updateStage()
  152.         end if
  153.       end if
  154.     end if
  155.   end if
  156. end
  157.  
  158. on tryFirst me
  159.   v = 0
  160.   fence.loc = fence.loc + (moveAm * 2)
  161.   repeat with n = 1 to hinderList.count
  162.     hinderList[n].loc = hinderList[n].loc + (moveAm * 2)
  163.   end repeat
  164.   updateStage()
  165.   if pippiMate.intersects(stopSprite) = interSectValue then
  166.     v = 1
  167.   end if
  168.   fence.loc = fence.loc + (moveAm * -1 * 2)
  169.   repeat with n = 1 to hinderList.count
  170.     hinderList[n].loc = hinderList[n].loc + (moveAm * -1 * 2)
  171.   end repeat
  172.   updateStage()
  173.   return v
  174. end
  175.  
  176. on walk me
  177.   if pippi.playing = 1 then
  178.     if pippi.member = member("walk", 1) then
  179.       if the ticks > stopCounter then
  180.         if collectList.count = 0 then
  181.           sndObject.respondSnd(1, 7, 1)
  182.         else
  183.           sndObject.respondSnd(1, 1, 1, 1)
  184.         end if
  185.         stopCounter = the ticks + (15 * 60)
  186.       end if
  187.       moveEveryHopa(me)
  188.     end if
  189.   else
  190.     if pippi.member = member("jump", 1) then
  191.       pippi.member = member("walk", 1)
  192.       updateStage()
  193.       pippi.stop()
  194.       pippi.frame = 8
  195.       updateStage()
  196.     end if
  197.   end if
  198. end
  199.  
  200. on stopMe me, pSprite, pInterSectValue
  201.   if stopSprite <> pSprite then
  202.     stopRotation = pippi.rotation
  203.     stopSprite = pSprite
  204.     interSectValue = pInterSectValue
  205.     pippi.stop()
  206.     pippi.frame = 8
  207.   end if
  208. end
  209.  
  210. on stopFind me, pMember
  211.   sound(3).play(member("sak-pos", 1))
  212.   updateStage()
  213.   repeat with n = 1 to saveObjectList.count
  214.     if saveObjectList[n].member = pMember then
  215.       foundSprite = saveObjectList[n]
  216.       exit repeat
  217.     end if
  218.   end repeat
  219.   foundSprite.locZ = 42
  220.   pippi.member = member("jump", 1)
  221.   updateStage()
  222.   startLoc = stopSprite.loc
  223.   goalLoc = pippi.loc
  224.   divideLoc = goalLoc - startLoc
  225.   amountLoc = divideLoc / 6
  226.   foundSprite.loc = startLoc
  227.   foundSprite.member = pMember
  228.   updateStage()
  229.   repeat with n = 1 to 6
  230.     t = the ticks + 2
  231.     repeat while the ticks < t
  232.     end repeat
  233.     foundSprite.loc = foundSprite.loc + amountLoc
  234.     updateStage()
  235.   end repeat
  236.   foundSprite.locZ = 60
  237.   walk(me)
  238.   repeat while intersect(rect(pippi.loc[1] - 50, pippi.loc[2] - 50, pippi.loc[1] + 50, pippi.loc[2] + 50), foundSprite.rect) > rect(0, 0, 0, 0)
  239.     foundSprite.loc = foundSprite.loc + amountLoc
  240.     updateStage()
  241.   end repeat
  242.   foundSprite.locZ = foundSprite.spriteNum + 30
  243.   updateStage()
  244.   walk(me)
  245.   if foundList.count > 2 then
  246.     sndObject.respondSnd(3, 3, 1, 1)
  247.   else
  248.     if foundList.count = 2 then
  249.       sndObject.respondSnd(1, 6)
  250.     else
  251.       sndObject.respondSnd(1, 2)
  252.       finished = 1
  253.     end if
  254.   end if
  255.   updateStage()
  256.   repeat while soundBusy(2)
  257.   end repeat
  258.   autoMove(autoMoveObject, foundSprite, foundSprite.meLoc)
  259.   foundSprite.locZ = foundSprite.spriteNum + 30
  260.   updateStage()
  261.   foundList.deleteOne(pMember)
  262.   collectList[collectList.count + 1] = pMember
  263.   if finished = 1 then
  264.     go("boat" & numName)
  265.   end if
  266.   stopCounter = the ticks + (15 * 60)
  267. end
  268.  
  269. on moveEveryHopa me
  270.   garden.loc = garden.loc + moveAm
  271.   fence.loc = fence.loc + moveAm
  272.   repeat with n = 1 to hinderList.count
  273.     hinderList[n].loc = hinderList[n].loc + moveAm
  274.   end repeat
  275.   repeat with n = 1 to overLayList.count
  276.     overLayList[n].loc = overLayList[n].loc + moveAm
  277.   end repeat
  278. end
  279.  
  280. on reportHinder me, pSprite
  281.   hinderList[hinderList.count + 1] = pSprite
  282. end
  283.  
  284. on reportHidden me
  285.   v = hiddenList[1]
  286.   hiddenList.deleteAt(1)
  287.   return v
  288. end
  289.  
  290. on reportOverLay me, pSprite
  291.   overLayList[overLayList.count + 1] = pSprite
  292. end
  293.  
  294. on reportSaveObjectSprite me, pSprite
  295.   saveObjectList[saveObjectList.count + 1] = pSprite
  296. end
  297.  
  298. on buttonX me
  299.   buttonPlayMode = 1
  300. end
  301.